
<extend name='Common/common'/>

<block name="content">
<link href="__PUBLIC_ADMIN__kindeditor/themes/default/default.css" rel="stylesheet" />
<article class="page-container">
	<article class="page-container">
	<form method="post" action="{:U('addBlog')}" class="form form-horizontal" id="form-article-add">
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2">博客栏目：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" readonly class="input-text" value="{$cat_name}" placeholder="" id="sources" name="source">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>文章标题：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="{$blog['title']}" placeholder="" id="articletitle" name="title">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>关键字：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" placeholder="请用英文逗号隔开" class="input-text" value="{:getKeyWords($_GET['blog_id'])}" placeholder="" id="articletitle" name="keywords">
			</div>
		</div>
		
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2">文章来源：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="{$blog['source']}" placeholder="" id="sources" name="source">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2">文章摘要：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<textarea class="textarea valid" name="description" aria-required="true" id="textarea" aria-invalid="false">{$blog['description']}</textarea>
			</div>
		</div>
		
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2">个人推荐：</label>
			<div class="formControls col-xs-8 col-sm-2 skin-minimal">
				<div class="check-box">
					<input type="checkbox" id="checkbox-moban" <if condition='$blog["is_commont"]==1'>checked</if> name="is_commont" value="1">
					<label for="checkbox-moban">&nbsp;</label>
				</div>
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2">图片上传：</label>
			
			<div class="formControls col-xs-8 col-sm-2 skin-minimal">
				<input type="button" value="上传" id="chooseImage" />
				<img id="imgbox" style="max-height: 150px;max-width: 220px;" src="<if condition='!empty($blog["theme"])'>{$blog['theme']}<else/>__PUBLIC_ADMIN__timg.jpg</if>"/>
			</div>
		</div>
		
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2">博客发布时间：</label>
			<div class="formControls col-xs-8 col-sm-2">
				<input name="time" type="text" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" id="datemin" readonly value="<if condition='empty($blog)'>{:date('Y-m-d H:i:s',$time)}<else/>{:date('Y-m-d H:i:s',$blog['time'])}</if>" class="input-text Wdate" style="width:180px;">
			</div>
		</div>
		
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2">文章内容：</label>
			<div class="formControls col-xs-8 col-sm-9"> 
				<script name='content' id="editor" type="text/plain" style="width:100%;height:400px;">{$blog['content']}</script> 
			</div>
		</div>
		<div class="row cl">
			<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
				<input type='hidden' name='cat_id' value='{$Think.get.id}' />
				<input type='hidden' name='id' value='<if condition="empty($_GET['blog_id'])">0<else/>{$Think.get.blog_id}</if>' />
				<button class="btn btn-primary radius" type="submit"><i class="Hui-iconfont">&#xe632;</i> 提交</button>
			</div>
		</div>
		<input type="hidden" name="theme" value="">
		<input type="hidden" id="oldImage" value="">
	</form>
</article>
<script src="__PUBLIC_ADMIN__kindeditor/kindeditor-all-min.js"></script>
<script src="__PUBLIC_ADMIN__kindeditor/lang/zh-CN.js"></script>
<script type="text/javascript">

$(function(){
	$("#textarea").Huitextarealength({minlength:0,maxlength:200});
})


    KindEditor.ready(function (K) {
        var editor = K.editor({
            uploadJson: '{:U('Base/uploadImage',array('theme'=>1))}',
             allowFileManager: true,
         });

         K('#chooseImage').click(function () {
             editor.loadPlugin('image', function () {
                 editor.plugin.imageDialog({
                    showRemote: false,
                     imageUrl: K('#PicUrl').val(),
                     clickFn: function (url, message, error) {
                         layer.msg('上传成功',{icon:6,time:500});
                         K("#imgbox").attr("src", url.split('|')[0]);
                         $("input[name=theme]").val(url);
                         editor.hideDialog();
                     }
                 });
             });
         });
    });
 </script>
 
<script type="text/javascript">
$(function(){
	$('.skin-minimal input').iCheck({
		checkboxClass: 'icheckbox-blue',
		radioClass: 'iradio-blue',
		increaseArea: '20%'
	});
	$("#form-article-add").validate({
		rules:{
			title:{
				required:true,
				minlength:2,
				maxlength:100
			},
			
		},
		onkeyup:false,
		focusCleanup:true,
		success:"valid",
		
	});
	var ue = UE.getEditor('editor');
	
});

</script>

</block>